-
rust]❤️const vs static & MIT에서 정리한_1.25ver_RUST뭔가 믿음직하다 ㅋ코딩Coding/한글Rust강의★내가★공부하려고만듬 2022. 4. 22. 12:06728x90
결국 stackoverflow ㅋㅋㅋ
https://stackoverflow.com/questions/52751597/what-is-the-difference-between-a-constant-and-a-static-variable-and-which-should
레딧
https://www.reddit.com/r/rust/comments/2jgurc/staticconst_classes/Const 예문 굿
러스트 const는 mut해도 변경 못함
static은 mut 변경 가능 하지만 unsafe
https://linuxhint.com/const-constants-rust/static은 이걸로 설명
주의점 까지 잘 나옴
https://doc.rust-lang.org/reference/items/static-items.htmlStatic은 결국 lifetime과 연결
복잡한 코드로 설명
https://youtu.be/tM2r9HD4ivQ
'static과 Rc<Trait>
https://stackoverflow.com/questions/51671192/prevent-static-lifetime-requirement-in-rctrait
static보단 static-rc
https://docs.rs/static-rc/latest/static_rc/
or lazy static
https://crates.io/crates/lazy_static
https://users.rust-lang.org/t/any-trick-to-initialize-an-rc-for-a-static-mut/16165
static설명 예정
https://www.mo4tech.com/const-constants-and-static-variables-in-rust.html
static inline에 관한 글
https://internals.rust-lang.org/t/inline-on-static/2688
Const generic specialization
Const generic specialization
I am curious if something is currently possible with const generics in Rust. I have a function that takes an array `[P; B]` where `P` is a type and `B` is a const generic. I'd like to specialize this function for cases where `B` = 1 — that is, arrays with exactly one element. In that case, a substantially more efficient approach is possible. Is such a specialization possible with the current features?
컴파일
Rust-PHF is a library to generate efficient lookup tables at compile time using perfect hash functions.
https://github.com/rust-phf/rust-phf
https://github.com/rust-lang/rfcs/blob/master/text/0246-const-vs-static.md
이 설명이 짱
근데 어렵다 이해가 안된다.
https://rust-lang.github.io/rfcs/0246-const-vs-static.html
MIT에 정리된 rust_ebook
The Rust Programming Language
ver.1.25 로 정리 됨
There are two editions of "The Rust Programming Language
https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/
second edition
https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/second-edition/index.html반응형'코딩Coding > 한글Rust강의★내가★공부하려고만듬' 카테고리의 다른 글