Skip to Content
이펙티브 러스트
book

이펙티브 러스트

by 데이비드 드라이스데일, 남기혁
October 2024
Beginner to intermediate
344 pages
7h 44m
Korean
Hanbit Media, Inc.
Content preview from 이펙티브 러스트
220
이펙티브 러스트
트레이트 업캐스팅이란
U
T
의 상위 트레이트 중 하나일 경우 (
trait
T
:
U
{...}
),
dyn
T
트레이트 객체를
dyn
U
트레이트 객체로 변환 (업캐스팅
upcasting
)할 수 있는 기능이다. 이 기능
이 정식으로 제공되기 전까지는
#![
feature
(
trait
_
upcasting
)]
로 사용해볼 수 있다.
12
앞에 나온 예에 이 기능을 적용하면
&
dyn
Shape
트레이트 객체를
&
dyn
Draw
트레이트 객체
로 변환할 수 있어서, 리스코프 치환 원칙의
is
-
a
관계에 더 가까워진다. 이렇게 변환할 수 있
게 되면
vtable
의 내부 구현이 [그림
3
-
5
]보다 훨씬 복잡해진다.
그렇다고 이 아이템의 핵심 내용이 달라지는 것은 아니다.
Any
트레이트보다 상위 트레이트는
없기 때문에 업캐스팅 기능에 의해 달라지는 점은 없다.
아이템
20
: 과도한 최적화의 유혹에 저항하라
러스트에서 할당도 없고 복사도 없는 매우 멋진 알고리즘을 안전하게 작성할 수 있다고 해서
러스트로 작성하기만 하면 무조건 할당도 없고 복사도 없는 매우 멋진 알고리즘이 되는 것은
니다.
trentj
(
https://oreil.ly/fQMfu
)
이 책에서 소개하는 아이템은 대부분 다른 언어에 능숙한 프로그래머가 러스트 언어의 문법과
러스트다운 관용 표현에 쉽게 ...
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