https://github.com/rsachdeva/drive-deposits
https://github.com/rsachdeva/simple-chat
https://github.com/rsachdeva
releases.rs
release-monitoring.org/project/7635/
github.com/rust-lang/ru...
#Rustlang
releases.rs
release-monitoring.org/project/7635/
github.com/rust-lang/ru...
#Rustlang
"hello" => println!("Found hello"),
_ => println!("Something else")
}
Pattern Match:
doc.rust-lang.org/reference/pa... shows String literals which are of &str type, not String. You can directly use "hello" but not "hello".to_string().
#rust #rustlang
"hello" => println!("Found hello"),
_ => println!("Something else")
}
Pattern Match:
doc.rust-lang.org/reference/pa... shows String literals which are of &str type, not String. You can directly use "hello" but not "hello".to_string().
#rust #rustlang
// Vec get signature has:
where I: SliceIndex<[T]>
// String get signature has:
where I: SliceIndex
SliceIndex implementations:
Vec ([T]): Both single index (usize) and ranges
String (str): Only ranges even for one character[s.get(0..1)] due to UTF-8
#Rust
#Rustlang
// Ok(val) => val,
// Err(_) => compute_default()
// }
let value = result.unwrap_or_else(|_| compute_default());
// Instead of match result {
// Ok(val) => val,
// Err(_) => Default::default()
// }
let value = result.unwrap_or_default();
#Rust #Rustlang
#rust #rustlang #asyncrust #tokio_rs
#rust #rustlang #asyncrust #tokio_rs
An async function, when called, returns a Future.
Note `when called` in async function...
#Rust #Async #Rustlang #AsyncRust
An async function, when called, returns a Future.
Note `when called` in async function...
#Rust #Async #Rustlang #AsyncRust
fn and_modify
1. Closure's return type F: FnOnce(&mut V) returns ()
2. Function and_modify's return type -> Self
Two returns serve different purposes- closure return is for modification, function's return enables fluent API chaining
fn and_modify
1. Closure's return type F: FnOnce(&mut V) returns ()
2. Function and_modify's return type -> Self
Two returns serve different purposes- closure return is for modification, function's return enables fluent API chaining
let mut writer = writer_half;
// And Reads very naturally in the code that follows
}
// 〰️
// Same as
fn execute(mut writer_half: OwnedWriteHalf) {
}
In both you get Direct link to parameter name passed
Choose by Readability. #Rust #Rustlang
await = waiting in anticipation
wait = passive waiting
That's why #AsyncRust (and some other languages) chose await - it's all about productive anticipation! #RustLang
await = waiting in anticipation
wait = passive waiting
That's why #AsyncRust (and some other languages) chose await - it's all about productive anticipation! #RustLang
In join!: Different branches merge back together; Like tributaries joining into a main river; All branches must complete to form the whole
#AsyncRust #Rustlang #tokio_rs
In join!: Different branches merge back together; Like tributaries joining into a main river; All branches must complete to form the whole
#AsyncRust #Rustlang #tokio_rs