Skip to Content
이펙티브 러스트
book

이펙티브 러스트

by 데이비드 드라이스데일, 남기혁
October 2024
Beginner to intermediate
344 pages
7h 44m
Korean
Hanbit Media, Inc.
Content preview from 이펙티브 러스트
45
1
타입
더 좋은 방법은 아예 이렇게 할 일이 없게 만드는 것이다. 즉, 표준 트레이트인
From
구현을 이
용해 (아이템
10
) 내부 오류 타입에서 외부 오류 타입을 생성할 수 있다면,
.
map
_
err
()
를 호
출하지 않아도 컴파일러가 자동으로 변환해 준다.
이런 변환 기법은 다양한 상황에 적용하도록 일반화할 수 있다. 여기서 물음표 연산자는 강력
하지만 광범위한 도구다. 단순히 물음표 연산자를 사용하기만 하지 말고
Option
Result
입에서 제공하는 다양한 변환 메서드를 이용해 물음표 연산자를 적용하기 좋게 만들어서 사용
하는 것이 좋다.
표준 라이브러리는 다양한 변환 메서드를 제공한다. [그림
1
-
1
]은 관련 타입 (짙은 색 박
스)끼리 변환해 주는 메서드 중에서도 가장 많이 사용되는 것들을 (옅은 색 박스 ) 보여 주
고 있다. 별표 (
*
)가 달린 메서드는 아이템
18
에서 설명할
panic
!
을 실행할 수 있는 메서
드다.
그림
1-1
Option
Result
변환
16
16
이 다이어그램의 온라인 버전(
https
://
oreil
.
ly
/
effective
_
rust
_
transforms
)에서는 각 상자를 클릭하면 상세 문서로 이동한다.
46
이펙티브 러스트
이 그림에는 표현되지 않았지만, 레퍼런스를 사용하지 않는 경우도 많다. 예를 들어 다음과 같
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