let _ = {
let foo = Foo {};
let bar = &foo;
(foo, bar)
};
(edited)let _ = {
let foo = Foo {};
let bar = &foo;
(foo, bar)
};
(edited)let _ = {
let foo = Foo {};
let bar = &foo;
(foo, bar)
};
(edited)Yoke
, which allows one to “yoke” (attach) a zero-copy deserialized object (say, a Cow<'a, str>
) to the source it was deserialized from, (say, an Rc<[u8]>
), known in this crate as a “cart”, producing a type that looks like Yoke, Rc<[u8]>>
and can be moved around with impunity.struct A {
buf: String,
slice: &str,
}
slice
points into buf
— moving it around causes no problems because the data slice
points to is boxedbuf
without also setting slice
to a new valueutop # let sum2 a b = a * b;;
val sum2 : int -> int -> int = <fun>
─( 14:31:39 )─< command 14 >──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # let sum_with_2 = sum2 2;;
val sum_with_2 : int -> int = <fun>
─( 14:31:44 )─< command 15 >──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # sum_with_2 4;;
- : int = 8
new
function takes an array of paths and returns Self, and I need a method which will find a function from paths provided in new
Box<[u8]>
instead. that has minimum capacityArc<[u8]>
so you don't have to keep two copies of it at allBox<[u8]>
instead. that has minimum capacity Vec::from(Box::from(slice))
shrink_to_fit
will most likely fit it or notVec::clone
generates the minimum necessary capacityawait
sounds like "takes a long time" but locks shouldn't be held for a long timeawait
sounds like "takes a long time" but locks shouldn't be held for a long time Send
Send
warning: this `MutexGuard` is held across an await point
--> src/lib.rs:5:9
|
5 | let x = a.read().unwrap();
| ^
|
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the await points this lock is held through
--> src/lib.rs:6:14
|
6 | hello2().await;
| ^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock
= note: `#[warn(clippy::await_holding_lock)]` on by default
pugnacious
= belligerent
= combative
(edited)opprobrium
= censure
File .text Size Crate
2.1% 30.7% 14.5MiB [Unknown]
0.8% 12.3% 5.8MiB std
0.4% 5.3% 2.5MiB ffmpeg_sys_next
0.2% 2.8% 1.3MiB cranelift_codegen
0.2% 2.8% 1.3MiB tokio
0.2% 2.2% 1.1MiB naga
0.1% 2.2% 1.0MiB wasmparser
0.1% 1.8% 887.9KiB client_ui
0.1% 1.8% 871.2KiB hashbrown
0.1% 1.8% 849.3KiB client_containers
0.1% 1.5% 730.9KiB rayon_core
0.1% 1.2% 579.2KiB egui
0.1% 1.1% 555.8KiB rustls
0.1% 1.0% 471.6KiB game_config
0.1% 0.9% 431.0KiB ddnet_playground
0.1% 0.9% 420.8KiB winit
0.1% 0.8% 390.7KiB serde_json
0.1% 0.8% 385.4KiB editor
0.1% 0.7% 358.2KiB regalloc2
0.0% 0.7% 352.6KiB zstd_sys
1.6% 22.9% 10.8MiB And 311 more crates. Use -n N to show more.
6.8% 100.0% 47.2MiB .text section size
LTO, codegen-units = 1, strip, panic = "abort".
Still the exec is around 60MiB====================[ Build | game-client | Debug ]=============================
"C:\Program Files\JetBrains\CLion 2024.2.2\bin\cmake\win\x64\bin\cmake.exe" --build C:\Users\ggdddz\Desktop\projects\ddnet\cmake-build-debug --target game-client -j 14
[0/2] Generating debug/libddnet_engine_shared.a
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s
[2/2] Linking CXX executable DDNet.exe
FAILED: DDNet.exe
C:\Windows\system32\cmd.exe /C "cd . && C:\mingw64\bin\c++.exe -g -mwindows @CMakeFiles\game-client.rsp -o DDNet.exe -Wl,--out-implib,libDDNet.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ."
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find debug/libddnet_engine_shared.a: No such file or directory
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
when starting game-client (edited)rustup default stable-x86_64-pc-windows-msvc
and then click on the hammer to rebuild the projectrustup default stable-x86_64-pc-windows-gnu
if you use mingw/GNUrustup default stable-x86_64-pc-windows-gnu
if you use mingw/GNU to create a code block
this is a codeblock
#include <iostream>
int main () { return 0; };
` to create a code block
this is a codeblock
#include <iostream>
int main () { return 0; };
` c++
#include <iostream>
#include <random>
int main(void)
{
std::random_device rd;
std::mt19937 g(rd());
std::uniform_int_distribution<int> dist(1, 6);
std::cout << dist(g) << ", " << dist(g) << std::endl;
return 0;
}
std::minstd_rand
instead of std::mt19937
doesn't really matter much honestly which generator you usexoshiro256++/xoshiro256**
seems to be first referenced inXOr
ROtate
SHift
and iirc the +
++
*
**
signify the output scramblers+
and ++
have less random lower bits, **
has better randomness but is trivially reversible