봇트레이드 러스트 밑천 기술

봇트레이드 출판

봇트레이드 러스트 밑천 기술

AI 가 코드를 쓰는 시대에 사람이 쥐고 있어야 할 기초를 러스트 한 권에 담았습니다.

봇트레이드 러스트 밑천 기술 · 456쪽

Google Play

맛보기 — 눌러서 들어 보세요A taste — tap to hear it

맛보기는 앞 두 장입니다. 모든 장은 책에 있습니다.

  1. 러스트업reoseuteueop

    rustup러스트업

    러스트 도구 모음을 깔고 판을 바꿔 주는 설치 도구The tool that installs Rust and switches between its versions

    러스트업으로 안정판을 깐다.Install the stable toolchain with rustup.

  2. 툴체인 (도구 모음)tulchein

    toolchain툴체인

    컴파일러·Cargo·표준 라이브러리를 한 벌로 묶은 것The compiler, Cargo and standard library bundled as one set

    도구 모음을 한 판으로 맞춰 둔다.Pin the toolchain to one version.

  3. 안정 버전 (안정판)anjeong beojeon

    stable스테이블

    한번 나오면 뜻이 바뀌지 않는, 일 할 때 쓰는 판The release you work on: once out, its meaning does not change

    일하는 코드는 안정판으로 짓는다.Build working code with the stable release.

  4. 새 꾸러미 만들기sae kkureomi mandeulgi

    cargo new카아고우 누

    폴더·설정 파일·첫 소스 파일을 한 번에 만드는 명령The command that creates a folder, a config file and a first source file

    새 꾸러미를 만든다.Create a new package.

  5. 짓고 돌리기jitgo dolligi

    cargo run카아고우 런

    고친 것을 다시 짓고 바로 실행하는 명령The command that rebuilds and then runs the program

    고친 뒤 바로 돌려 본다.Run it right after the change.

  6. 짓기jitgi

    cargo build카아고우 빌드

    실행 파일을 만들기만 하는 명령The command that only builds the executable

    실행 파일만 지어 둔다.Just build the executable.

  7. 맞는지만 보기manneunjiman bogi

    cargo check카아고우 첵

    실행 파일을 만들지 않고 틀린 데만 빨리 찾아 주는 명령The command that checks for errors fast without producing an executable

    에러가 있나 빨리 본다.Check quickly whether there are errors.

  8. 컴파일하다keompailhada

    compile컴파일

    사람이 쓴 글을 기계가 바로 읽는 말로 옮기다To turn human-written text into what the machine runs directly

    컴파일하면 기계가 읽는 말이 된다.Compiling turns it into what the machine reads.

  9. 컴파일러keompailleo

    compiler컴파일러

    컴파일을 하면서 틀린 곳도 같이 짚어 주는 프로그램The program that compiles and also points out what is wrong

    컴파일러가 틀린 줄을 짚어 준다.The compiler points at the wrong line.

  10. 컴파일 에러keompail ereo

    compile error컴파일 에러

    짓는 동안 잡혀서 아예 실행되지 않는 잘못A mistake caught while building, so the program never runs

    컴파일 에러가 있으면 실행되지 않는다.With a compile error it does not run at all.

  11. 에러 메시지ereo mesiji

    error message에러 메서지

    무엇이 어디서 왜 틀렸는지 알려 주는 글The text that says what went wrong, where, and why

    에러 메시지를 끝까지 읽는다.Read the error message to the end.

  12. 에러 코드ereo kodeu

    error code에러 코우드

    오류마다 붙은 번호 — 그 번호로 자세한 설명을 찾는다The number on each error, used to look up a longer explanation

    에러 코드로 설명을 찾아 본다.Look the explanation up by its error code.

  13. 경고gyeonggo

    warning워닝

    돌아가기는 하지만 고치는 게 좋다는 알림A notice that the code runs but is better fixed

    경고는 돌아가지만 남겨 두지 않는다.A warning still runs, but do not leave it.

  14. 도움말doummal

    help message헬프 메서지

    에러 밑에 붙는 「이렇게 고쳐 보라」는 줄The 'try this instead' line printed under an error

    도움말 그대로 고쳐 본다.Try the fix the help message suggests.

  15. 백트레이스 (호출 흔적)baekteureiseu

    backtrace백트레이스

    멈춘 자리까지 어떤 함수를 거쳐 왔는지의 목록The list of functions the program went through before it stopped

    호출 흔적으로 어디서 멈췄나 본다.Use the backtrace to see where it stopped.

  16. main 함수main hamsu

    main메인

    프로그램이 처음 들어가는 문The door the program enters through first

    프로그램은 main 에서 시작한다.A program starts at main.

  17. 출력 매크로chullyeok maekeuro

    println!프린트을라인

    줄 하나를 화면에 찍는 매크로A macro that prints one line to the screen

    값을 한 줄로 찍어 본다.Print the value on one line.

  18. 함수hamsu

    function풩크션

    이름 붙인 일 묶음 — 불러 쓰고 값을 돌려받는다A named bundle of work you call and get a value back from

    두 수를 더하는 함수를 만든다.Write a function that adds two numbers.

  19. 매크로maekeuro

    macro매크로

    코드를 대신 적어 주는 코드 — 이름 끝에 느낌표가 붙는다Code that writes code for you; its name ends with an exclamation mark

    println! 은 매크로라 느낌표가 붙는다.println! is a macro, so it ends with an exclamation mark.

  20. 소스 파일soseu pail

    source file소스 퐈일

    사람이 글로 써 둔 코드 파일The file holding the code as a person wrote it

    소스 파일을 열어 고친다.Open the source file and change it.

  21. 타깃 디렉터리 (결과 폴더)tagit direkteori

    target directory타깃 더렉터리

    지은 결과가 쌓이는 폴더 — 지워도 다시 생긴다The folder build results pile up in; safe to delete, it comes back

    결과 폴더가 커지면 지워도 된다.You may delete the target directory when it grows.

  22. 고치기gochigi

    fix퓍스

    에러 메시지가 가리킨 줄을 바꿔 다시 짓기Changing the line the error points at and building again

    가리킨 줄을 고치고 다시 짓는다.Fix the line it points at and build again.

  23. 러스트reoseuteu

    rust러스트

    빠르면서 메모리 안전까지 컴파일 때 따지는 프로그래밍 언어A programming language that is fast and checks memory safety at compile time

    러스트는 컴파일 때 메모리를 따진다.Rust checks memory at compile time.

  24. 컴파일 언어keompail eoneo

    compiled language컴파일드 을랭궈지

    돌리기 전에 미리 기계어로 옮겨 두는 언어A language translated to machine code before it runs

    컴파일 언어는 돌리기 전에 지어 둔다.A compiled language is built before it runs.

  25. 정적 타입jeongjeok taip

    static typing스태틱 타이핑

    값의 종류를 돌리기 전에 정해 두고 검사하는 방식Deciding and checking the kind of every value before the program runs

    정적 타입이라 돌리기 전에 잡힌다.With static typing it is caught before running.

  26. 타입 안전성taip anjeonseong

    type safety타이프 세이픠티

    숫자 자리에 글자가 들어가는 일을 컴파일러가 막아 주는 것The compiler stopping, say, text from landing where a number belongs

    타입 안전이 엉뚱한 값을 막는다.Type safety stops the wrong kind of value.

  27. 메모리 안전memori anjeon

    memory safety메머리 세이픠티

    이미 치운 자리를 다시 읽거나 쓰는 일이 일어나지 않는 것Never reading or writing memory that has already been cleaned up

    메모리 안전은 공짜가 아니라 규칙으로 얻는다.Memory safety comes from rules, not for free.

  28. 제로 비용 추상화jero biyong chusanghwa

    zero-cost abstraction지로-카스트 애브스트랙션

    읽기 좋게 쓴 코드가 손으로 쓴 것보다 느려지지 않는다는 약속The promise that readable code is no slower than hand-written code

    공짜 추상화라 읽기 좋게 써도 느려지지 않는다.With zero-cost abstraction, readable code stays fast.

  29. 언어 런타임eoneo reontaim

    language runtime을랭궈지 런타임

    프로그램 밑에서 같이 돌아가는 관리자 — 러스트는 이것이 거의 없다A manager running under your program; Rust has almost none

    언어 런타임이 거의 없어 작게 나온다.Almost no language runtime keeps it small.

  30. 가비지 컬렉션gabiji keolleksyeon

    garbage collection가비지 컬렉션

    안 쓰는 메모리를 돌면서 치우는 방식 — 러스트는 쓰지 않는다Cleaning unused memory by sweeping it later; Rust does not do this

    쓰레기 수집이 없어 멈춤이 없다.With no garbage collection there are no pauses.

  31. 정의되지 않은 동작jeonguidoeji aneun dongjak

    undefined behavior언디퐈인드 비헤이뷔어

    규칙을 깨면 무슨 일이 일어나도 이상하지 않은 상태A state where, once a rule is broken, anything may happen

    미정의 동작은 운에 맡기는 일이다.Undefined behavior leaves it to luck.

  32. 널neol

    null널

    「없음」을 가리키는 빈 값 — 러스트는 이것 대신 Option 을 쓴다An empty value meaning 'nothing'; Rust uses Option instead

    널 대신 Option 으로 「없음」을 적는다.Write 'nothing' with Option instead of null.

  33. 댕글링 포인터daenggeulling pointeo

    dangling pointer댕걸링 포인터

    이미 없어진 자리를 아직 가리키고 있는 손가락A finger still pointing at a place that is already gone

    매달린 포인터는 컴파일러가 막는다.The compiler stops a dangling pointer.

  34. 데이터 레이스deiteo reiseu

    data race데이타 레이스

    둘이 같은 자리를 동시에 건드려 값이 망가지는 일Two sides touching the same spot at once and wrecking the value

    데이터 경쟁은 타입으로 막는다.Data races are stopped by types.

  35. 성능seongneung

    performance퍼푀먼스

    같은 일을 얼마나 빨리, 얼마나 적은 메모리로 하나How fast and with how little memory the same work gets done

    성능은 재어 보고 말한다.Measure before you talk about performance.

  36. 이식성isikseong

    portability포터빌리티

    같은 코드를 다른 기계·운영체제에서도 쓸 수 있는 정도How far the same code carries to other machines and systems

    이식성이 있으면 다른 기계에서도 짓는다.With portability it builds on other machines too.

  37. 하위 호환hawi hohwan

    backward compatibility배쿼드 컴패터빌러티

    새 판이 나와도 옛 코드가 그대로 돌아가는 것Old code still running when a new version comes out

    하위 호환이라 옛 코드가 그대로 돈다.Backward compatibility keeps old code running.

  38. 에디션 (판)edisyeon

    edition어디션

    언어의 큰 매듭 — 옛 판 코드와 새 판 코드가 같이 돌아간다A milestone of the language; old-edition and new-edition code work together

    판을 올려도 옛 크레이트와 같이 쓴다.Even after moving editions, old crates still work with it.

  39. 릴리즈 채널rillijeu chaeneol

    release channel릴리스 채늘

    안정판·베타·나이틀리 — 얼마나 익었는지로 나눈 줄Stable, beta and nightly: lines split by how settled they are

    배포 줄기 가운데 안정판을 고른다.Pick stable among the release channels.

  40. 나이틀리naiteulli

    nightly나이틀리

    매일 나오는, 아직 굳지 않은 기능까지 든 판The nightly build, including features that are not settled yet

    나이틀리 기능은 일하는 코드에 쓰지 않는다.Do not use nightly features in working code.

  41. 사양sayang

    specification스페시퓌케이션

    무엇을 만들지 말로 정확히 적어 둔 것What to build, written down exactly in words

    사양을 적고 나서 코드를 맡긴다.Write the specification, then hand over the code.

  42. 절충 (맞바꿈)jeolchung

    trade-off트레이드-오픠

    하나를 얻으려면 하나를 내주는 선택A choice where gaining one thing means giving up another

    빠름과 쉬움은 맞바꿈이다.Speed and ease are a trade-off.

  1. Q러스트를 어떻게 깔아?reoseuteureul eotteoke kkara?How do I install Rust?하우 두 아이 인스톨 러스트

    A러스트업을 깔면 컴파일러와 카고가 한 벌로 들어와.reoseuteueobeul kkalmyeon keompailleowa kagoga han beollo deureowa.Install rustup and the compiler and Cargo come as one set.인스톨 러스트업 앤드 둬 컴파일러 앤드 카아고우 컴 애즈 원 셋

  2. Q새 꾸러미는 어떻게 시작해?sae kkureomineun eotteoke sijakae?How do I start a new package?하우 두 아이 스타트 어 누 패커지

    A새 꾸러미 만들기를 하면 폴더와 설정 파일과 첫 소스 파일이 생겨.sae kkureomi mandeulgireul hamyeon poldeowa seoljeong pailgwa cheot soseu pairi saenggyeo.Create a new package and you get a folder, a config file and a first source file.크리에잇 어 누 패커지 앤드 유 겟 어 푀울더 어 컨퓌그 퐈일 앤드 어 풔스트 소스 퐈일

  3. Q에러가 났는데 뭘 먼저 봐?ereoga nanneunde mwol meonjeo bwa?An error came up. What do I look at first?앤 에러 케임 업 왓 두 아이 을룩 앳 풔스트

    A에러 메시지의 첫 줄과 가리킨 줄 번호를 봐. 밑에 도움말이 붙어 있을 때가 많아.ereo mesijiui cheot julgwa garikin jul beonhoreul bwa. mite doummari buteo isseul ttaega mana.Read the first line of the error message and the line number it points at; a help line often follows.레드 둬 풔스트 을라인 어븨 둬 에러 메서지 앤드 둬 을라인 넘버 잇 포인츠 앳 어 헬프 을라인 오픤 퐐로즈

  4. Q경고는 그냥 둬도 돼?gyeonggoneun geunyang dwodo dwae?Can I just leave a warning?캔 아이 저스트 을리븨 어 워닝

    A돌아가기는 해. 그래도 쌓이면 진짜 에러를 못 보니까 그때그때 고치는 게 좋아.doragagineun hae. geuraedo ssaimyeon jinjja ereoreul mot bonikka geuttaegeuttae gochineun ge joa.It still runs, but warnings pile up and hide real errors, so fix them as they come.잇 스틸 런즈 벗 워닝즈 파일 업 앤드 하이드 릴 에러즈 소우 퓍스 뒘 애즈 뒈이 컴

  5. QAI 가 준 코드를 어디에 넣어?AI ga jun kodeureul eodie neoeo?Where do I put the code AI gave me?웨어 두 아이 풋 둬 코우드 에이아이 게이븨 미

    A새 꾸러미를 만들고 src 의 소스 파일에 넣은 뒤 짓고 돌려 봐.sae kkureomireul mandeulgo src ui soseu paire neoeun dwi jitgo dollyeo bwa.Make a new package, put it in the source file under src, then build and run.메이크 어 누 패커지 풋 잇 인 둬 소스 퐈일 언더 에스알씨 뒌 빌드 앤드 런

  6. Q돌려 보지 않고 믿어도 돼?dollyeo boji anko mideodo dwae?Can I trust it without running it?캔 아이 트러스트 잇 위돠웃 러닝 잇

    A안 돼. 짓고 돌려서 나온 글까지 봐야 아는 거야.an dwae. jitgo dollyeoseo naon geulkkaji bwaya aneun geoya.No. You only know once you build it, run it and look at what it printed.노우 유 온리 노우 원스 유 빌드 잇 런 잇 앤드 을룩 앳 왓 잇 프린티드

  7. Q에러가 여러 개 나오면 어디부터 고쳐?ereoga yeoreo gae naomyeon eodibuteo gochyeo?If several errors come out, which do I fix first?이픠 세븨럴 에러즈 컴 아웃 위치 두 아이 퓍스 풔스트

    A맨 위부터. 앞 에러 하나가 뒤 에러를 여럿 만들어 내거든.maen wibuteo. ap ereo hanaga dwi ereoreul yeoreot mandeureo naegeodeun.The top one. A single earlier error often makes several later ones.둬 탑 원 어 싱글 얼리어 에러 오픤 메이크스 세븨럴 을레이터 원즈

  8. Q에러 코드는 어디에 써?ereo kodeuneun eodie sseo?What is the error code for?왓 이즈 둬 에러 코우드 푀

    A그 번호로 긴 설명을 찾아 읽어. 왜 그런 규칙인지까지 나와.geu beonhoro gin seolmyeongeul chaja ilgeo. wae geureon gyuchiginjikkaji nawa.You look up the long explanation by that number; it even says why the rule exists.유 을룩 업 둬 을롱 엑스플러네이션 바이 됏 넘버 잇 이븬 세즈 와이 둬 룰 이그지스츠

  9. QAI 가 에러를 못 고치고 같은 답만 줘.AI ga ereoreul mot gochigo gateun damman jwo.AI cannot fix the error and keeps giving the same answer.에이아이 캐낫 퓍스 둬 에러 앤드 킵스 기뷩 둬 세임 앤서

    A에러 메시지를 그대로 붙여 주고, 네 코드도 같이 보여 줘.ereo mesijireul geudaero butyeo jugo, ne kodeudo gachi boyeo jwo.Paste the error message as it is, and show your code with it.페이스트 둬 에러 메서지 애즈 잇 이즈 앤드 쇼우 요 코우드 위듸 잇

  10. Q경고만 잔뜩 나왔어.gyeonggoman jantteuk nawasseo.I got a pile of warnings.아이 갓 어 파일 어븨 워닝즈

    A돌아가기는 해. 그래도 안 쓰는 변수나 안 쓰는 함수가 있다는 뜻이라 지워 두는 게 좋아.doragagineun hae. geuraedo an sseuneun byeonsuna an sseuneun hamsuga itdaneun tteusira jiwo duneun ge joa.It still runs, but it means there are unused variables or functions, so clean them up.잇 스틸 런즈 벗 잇 민즈 뒈어 아 어뉴즈드 붸리어블즈 오 풩크션즈 소우 클린 뒘 업

  11. Q매크로랑 함수는 뭐가 달라?maekeurorang hamsuneun mwoga dalla?What is the difference between a macro and a function?왓 이즈 둬 디풔런스 비트윈 어 매크로 앤드 어 풩크션

    A함수는 값을 받아 일하고, 매크로는 코드를 대신 적어 줘. 이름 끝 느낌표로 알아봐.hamsuneun gapseul bada ilhago, maekeuroneun kodeureul daesin jeogeo jwo. ireum kkeut neukkimpyoro arabwa.A function takes values and works; a macro writes code for you. Tell them apart by the exclamation mark.어 풩크션 테이크스 봴류즈 앤드 워크스 어 매크로 라잇츠 코우드 푀 유 텔 뒘 어파트 바이 둬 엑스클러메이션 마크

  12. Q짓기만 하고 안 돌려 봐도 돼?jitgiman hago an dollyeo bwado dwae?Is building without running enough?이즈 빌딩 위돠웃 러닝 이너픠

    A컴파일 에러는 잡히지만 답이 맞는지는 몰라. 돌려 보고 테스트까지.keompail ereoneun japijiman dabi manneunjineun molla. dollyeo bogo teseuteukkaji.It catches compile errors but not wrong answers. Run it, then test it.잇 캐치즈 컴파일 에러즈 벗 낫 롱 앤서즈 런 잇 뒌 테스트 잇

차례 — 19장Contents — 19 chapters

  1. 0처음Getting Started
  2. 1러스트를 왜 고르나Why Rust
  3. 2Cargo 와 한 벌Cargo and One Set
  4. 3값과 타입Values and Types
  5. 4글자 두 가지Two Kinds of Text
  6. 5흐름과 맞춤Flow and Matching
  7. 6구조체와 메서드Structs and Methods
  8. 7소유권Ownership
  9. 8빌림과 수명Borrowing and Lifetimes
  10. 9트레이트Traits
  11. 10제네릭Generics
  12. 11오류 다루기Handling Errors
  13. 12모아 두기Collections
  14. 13반복과 클로저Iterators and Closures
  15. 14스마트 포인터Smart Pointers
  16. 15동시에Doing It at Once
  17. 16기다리기Waiting
  18. 17모듈과 공개Modules and Visibility
  19. 18시험·내보내기·AI 와Tests, Shipping, and Working with AI
봇트레이드가 낸 책 모두 보기Every book from BotTrade→