-
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-shouldWhat is the difference between a constant and a static variable and which should I choose?
I know this from RFC 246: constants declare constant values. These represent a value, not a memory address. This is the most common thing one would reach for and would replace static as we kn...
stackoverflow.com
레딧
https://www.reddit.com/r/rust/comments/2jgurc/staticconst_classes/Static/Const classes
If I want to have a single, globally accessible instant of a class how can I go about that? I know that the static/const rules changed recently...
www.reddit.com
Const 예문 굿
러스트 const는 mut해도 변경 못함
static은 mut 변경 가능 하지만 unsafe
https://linuxhint.com/const-constants-rust/Rust Const Constants
My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to Linux
linuxhint.com
static은 이걸로 설명
주의점 까지 잘 나옴
https://doc.rust-lang.org/reference/items/static-items.htmlStatic items - The Rust Reference
Syntax StaticItem : static mut? IDENTIFIER : Type ( = Expression )? ; A static item is similar to a constant, except that it represents a precise memory location in the program. All references to the static refer to the same memory location. Static it
doc.rust-lang.org
Static은 결국 lifetime과 연결
복잡한 코드로 설명
https://youtu.be/tM2r9HD4ivQ
'static과 Rc<Trait>
https://stackoverflow.com/questions/51671192/prevent-static-lifetime-requirement-in-rctraitPrevent 'static lifetime requirement in Rc<Trait>
Where is the 'static lifetime requirement coming from when using a trait type in std::rc::Rc and how can I prevent it? E.g. when trying to compile this code trait Handler{} fn add(a: std::rc::Rc...
stackoverflow.com
static보단 static-rc
https://docs.rs/static-rc/latest/static_rc/static_rc - Rust
StaticRc, resp. StaticRcRef, use Rust’s affine type system and const generics to track the shared ownership of a heap-allocated, resp. reference, value safely at compile-time, with no run-time overhead. The amount of unsafe used within is minimal, Static
docs.rs
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/16165Any trick to initialize an RC for a static mut?
I’m trying to provide an reasonable way for callback functions to get access to a handle without passing the handle around (let’s just stipulate that for the next few moments that this is reasonable). I’d like to do something like: fn get_handle() ->
users.rust-lang.org
static설명 예정
https://www.mo4tech.com/const-constants-and-static-variables-in-rust.htmlConst constants and static variables in Rust - Moment For Technology
When defining constants, variables are usually named in all uppercase (such as ***NUM***). It is not mandatory, but warning is included. Constants can be defined in any scope and defined throughout the life of the program. At compile time, the compiler inl
www.mo4tech.com
static inline에 관한 글
https://internals.rust-lang.org/t/inline-on-static/2688#[inline] on static
I thought #[inline] can be applied to only functions, but it seems that it can be also applied to statics. What does it mean to apply #[inline] to statics? See https://github.com/rust-lang/rust/pull/28650.
internals.rust-lang.org
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...
www.reddit.com
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-phfGitHub - rust-phf/rust-phf: Compile time static maps for Rust
Compile time static maps for Rust. Contribute to rust-phf/rust-phf development by creating an account on GitHub.
github.com
https://github.com/rust-lang/rfcs/blob/master/text/0246-const-vs-static.mdGitHub - rust-lang/rfcs: RFCs for changes to Rust
RFCs for changes to Rust. Contribute to rust-lang/rfcs development by creating an account on GitHub.
github.com
이 설명이 짱
근데 어렵다 이해가 안된다.
https://rust-lang.github.io/rfcs/0246-const-vs-static.html0246-const-vs-static - The Rust RFC Book
Divide global declarations into two categories: constants declare constant values. These represent a value, not a memory address. This is the most common thing one would reach for and would replace static as we know it today in almost all cases. statics de
rust-lang.github.io
const and static - The Rust Programming Language
const and static Rust has a way of defining constants with the const keyword: # #![allow(unused_variables)] #fn main() { const N: i32 = 5; #} Unlike let bindings, you must annotate the type of a const. Constants live for the entire lifetime of a program. M
web.mit.edu
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/The Rust Programming Language
The second edition is a complete re-write. It is still under construction, though it is far enough along to learn most of Rust. We suggest reading the second edition and then checking out the first edition later to pick up some of the more esoteric parts o
web.mit.edu
Introduction - The Rust Programming Language
Welcome! This book will teach you about the Rust Programming Language. Rust is a systems programming language focused on three goals: safety, speed, and concurrency. It maintains these goals without having a garbage collector, making it a useful language f
web.mit.edu
second edition
https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/second-edition/index.htmlIntroduction - The Rust Programming Language
Welcome to “The Rust Programming Language,” an introductory book about Rust. Rust is a programming language that helps you write faster, more reliable software. High-level ergonomics and low-level control are often at odds with each other in programmin
web.mit.edu
반응형'코딩Coding > 한글Rust강의★내가★공부하려고만듬' 카테고리의 다른 글