Skip to content

Instantly share code, notes, and snippets.

View magnet's full-sized avatar
⚙️
Rustin'

Simon Chemouil magnet

⚙️
Rustin'
View GitHub Profile
@magnet
magnet / rust2019.md
Last active December 25, 2018 19:11
#Rust 2019 -- Finish Core Stuff!

Rust 2019 --- Finish core stuff

I am a relatively new in Rust, but I believe I have gathered enough experience the last few months to enjoy its strengths and discover some of its current shortcomings. Being relatively new at Rust, I am also of this generation that started immediately with Edition 2018. I switched to nightly very early on, and recently have been porting some code back to stable (1.31.x). I am overall very satisfied with Rust, but sometimes I come across something that doesn't work as I hoped. Every time that happens, I discover there is work-in-progress solving these issues, including, most of the time, a merged RFC, a nightly implementation behind feature gates or at least some blogs from core developers. Many time, the work I come across is from many years back.

I have read several #Rust2019 and I want to use this opportunity to agree with those that suggest to finish current core stuff.

Rust core developers can only do so much. Yes, it would be nice to spend more energy kicks

fn main() {
let s = "Foo";
let s = foo(s);
println!("{}", s);
}
fn foo(s: &str) -> &str {
let s2 = "Bar";
println!("{}", s2);
s
use std::ops;
#[derive(Debug)]
struct Point(i32, i32);
impl ops::Add<Point> for Point {
type Output = Point;
fn add(self, _rhs: Point) -> Point {
Point(self.0 + _rhs.0, self.1 + _rhs.1)
}
fn main() {
let s = "Foo".to_string();
let s = foo(s);
println!("{}", s);
}
fn foo(_s: String) -> String {
let s2 = "Bar".to_string();
println!("{}", s2);
s2
@magnet
magnet / OwnershipFixed.rs
Created October 6, 2018 20:49
Showing ownership
fn main() {
let s = "Foo".to_string();
let s = foo(s);
println!("{}", s);
}
fn foo(s: String) -> String {
let s2 = "Bar".to_string();
println!("{}", s2);
s
@magnet
magnet / OwnershipFail.rs
Created October 6, 2018 20:25
Demonstrating ownership transfer
fn main() {
let s = "Foo".to_string();
let newS = foo(s);
println!("{}", s);
}
fn foo(s: String) -> String {
let s2 = "Bar".to_string();
println!("{}", s2);
s
@magnet
magnet / designer.html
Last active August 29, 2015 14:06
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">