Skip to Content
이펙티브 러스트
book

이펙티브 러스트

by 데이비드 드라이스데일, 남기혁
October 2024
Beginner to intermediate
344 pages
7h 44m
Korean
Hanbit Media, Inc.
Content preview from 이펙티브 러스트
241
4
의존성
야 한다.
이렇게 조언하는 첫 번째 이유는 한 번 가시성을 높이면 다시 되돌리기 어렵기 때문이다. 어
떤 크레이트 항목을 공개해버리면, 나중에 다시 비공개로 전환하기 위해서는 그 크레이트를 사
용하는 코드를 수정할 수밖에 없어서 결국 메이저 버전 올림(아이템
21
)을 해야 한다. 하지만
그 반대는 괜찮다. 비공개로 한 상태에서 나중에 공개로 전환할 때는 마이너 버전 올림만으로
도 충분한 경우가 많아서 크레이트 사용자에게는 아무런 영향을 미치지 않는다. 러스트의
API
호환성 가이드라인 (
https
://
oreil
.
ly
/
CkFWN
)을 읽어 보면 대부분
pub
항목에 대한 내용
이다.
비공개가 바람직한 중요하고도 미묘한 두 번째 이유는 선택권이 있기 때문이다. 공개된 항목이
많을수록 (호환되지 않는 변경이 없는 한) 나중에도 계속 고정돼야 할 항목도 많아진다. 데이
터 구조의 내부 구현 세부 사항을 공개해버리면, 나중에 더 효율적인 알고리즘을 적용할 기회
가 생길 때 중대한 변경이 발생할 수밖에 없다. 내부 헬퍼 함수를 공개하면, 그 함수의 세부 사
항에 의존하는 외부 코드가 생길 수밖에 없다.
물론 이런 문제는 수명이 길고 사용자도 많은 라이브러리 코드에서만 발생한다. 하지만 임
시 해결책이 결국 영구적으로 남기 마련이므로 이 조언을 따라 작성하는 습관을 들이는 것이
좋다.
또한 가시성을 제한하라는 조언은 이번 아이템
22
나 러스트 언어에만 적용되는 것은 아니다.
러스트
API
가이드라인 (
https://oreil.ly
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

이펙티브 타입스크립트

이펙티브 타입스크립트

Dan Vanderkam
파이썬으로 살펴보는 아키텍처 패턴

파이썬으로 살펴보는 아키텍처 패턴

오현석, 해리 퍼시벌, 밥 그레고리

Publisher Resources

ISBN: 9791169212946