Rust pro-tip: If you read to a buffer, and read a variable number of items, don't return Ok(count)! Instead return the valid subslice instead! not: fn read(&mut buf) -> Result<usize>; instead: fn read(buf: &mut [u8]) -> Result<&mut [u8]>;
-
Prikaži ovu nit
-
Example: This keeps you from having the user re-make a slice, or accidentally using the original full-sized buffer entirely. The borrow checker is so good now, you almost never need to check lifetimes or add explicit scopes.pic.twitter.com/wb871lINMV
5 replies 1 proslijeđeni tweet 24 korisnika označavaju da im se sviđaPrikaži ovu nit
Err, that should be Ok, not Some, but you get the point 
14:31 - 30. sij 2020.
0 replies
0 proslijeđenih tweetova
7 korisnika označava da im se sviđa
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.