Introducing Rust 1.34.0

2019-04-23

Fukuoka.rs vol.3

at VEGA corporation

huyuumi

Whoami

avatar

Focusing on contributing to Rust and Diesel...

Talk at RustLab 2019🎉

RustLab 2019

More information -> https://neet.club

🎉

Rust 1.34.0

What's new?

Alternative cargo registries

until now...

Someone: I wanna use the crate but it's private(not published to crates.io).

We: You can use `git` dependencies, not `crates.io` (registries).

-> We couldn't our own registries...

Since Rust 1.34.0

We can use alternative registries!

In .cargo/config

						
[registries]
yuzuki-roa = { index = "https://yuzukiroa.love/git/index" }
						
					

In Cargo.toml

						
[dependencies]
roa-love = { version = "0.1.0", registry ="yuzuki-roa" }
						
					

Note:

At this time, there is no widely used software for running a custom registry.

ref. https://doc.rust-lang.org/nightly/cargo/reference/registries.html#running-a-registry

`TryFrom` and `TryInto` were stabilized

From

e.g. String::from("yuzukiroa")

Into

e.g. "str"(or String).into()

Note: require specification of the type

About TryFrom

						
let big_number = 1_000_000_000_000i64;
// Integer overflow
let smaller_number = big_number as i32;
assert_eq!(smaller_number, -727379968);

// Returns error if overflowing
let try_smaller_number = i32::try_from(big_number);
assert!(try_smaller_number.is_err());

// Returns OK if not overflowing
let try_successful_smaller_number = i32::try_from(3);
assert!(try_successful_smaller_number.is_ok());
						
					

More information -> https://doc.rust-lang.org/rust-by-example/conversion/from_into.html

extern crate self

You can write now!

						
extern crate self as roa;

mod foo { ... }

use roa::foo;
::roa::foo;
						
					

And more...

Custom attributes accept arbitrary token streams

`?` operator in documentation tests

Stabilize some APIs

Enjoy Rust!

(And say goodbye Heisei...)