This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
println!("Hello, world!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use serde::Serialize; | |
#[derive(Serialize)] | |
enum Token { | |
S(String), | |
_I(i32), | |
} | |
#[derive(Serialize)] | |
struct Foo { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn identity<T: ?Sized, F>(f: F) -> F | |
where | |
F: for<'a> Fn(&'a T) -> &'a T, | |
{ | |
f | |
} | |
fn foo(_f: impl for<'a> Fn(&'a str) -> &'a str) {} | |
fn main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let closure = |s: &str| s; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let closure = |s: &str| { | |
s | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let bound = |s: Option<&'_ str>| -> &'_ str { | |
s.unwrap() | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::net; | |
fn main() { | |
let ip: Result<net::IpAddr, _> = "::1".parse(); | |
println!("{:?}", ip); | |
let addr = net::SocketAddr::new(ip.unwrap(), 9200); | |
println!("{:?}", addr); | |
println!("{}", addr); | |
println!("{}", addr.ip()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
println!("Hello, world!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Greeter { | |
name: String, | |
} | |
impl Greeter { | |
fn greet(&self) { | |
println!("Hey, {}!", self.name); | |
} | |
} | |
fn main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Greeter { | |
name: String, | |
} | |
impl Greeter { | |
fn greet(&self) { | |
println!("Hey, {}!", self.name); | |
} | |
} | |
fn main() { |