These are chat archives for rust-lang/rust

Feb 2017
Peter Atashian
Feb 10 2017 00:05
In Java the behavior is omnipresent, in Rust it is opt-in
Feb 10 2017 01:49
-1 as f64 ?
non-scalar cast: {integer} as f64
I just need to call a function that takes an f64 :P
Feb 10 2017 01:57
I fixed it
what's the difference?
ah, one is casting one is setting the type? idk
return self.lerp(0f64, self.lerp(w, self.lerp(u, self.grad(self.permutations[b as usize], x, z, 0f64), self.grad(self.permutations[pz as usize], x - 1.0 as f64, z, 0f64)), self.lerp(u, self.grad(self.permutations[a as usize], x, z - 1.0 as f64, 0f64), self.grad(self.permutations[px as usize], x - 1.0 as f64, z - 1.0 as f64, 0f64))), self.lerp(w, self.lerp(u, self.grad(self.permutations[(b + 1) as usize], x, z, -1f64), self.grad(self.permutations[(pz + 1) as usize], x - 1.0 as f64, z, -1f64)), self.lerp(u, self.grad(self.permutations[(a + 1) as usize], x, z - 1.0 as f64, -1f64), self.grad(self.permutations[(px + 1) as usize], x - 1.0 as f64, z - 1.0 as f64, -1f64))));
very clean, concise code
Feb 10 2017 02:06
say you'd do something like private PerlinNoise[] algs; in java. then this.algs = new PerlinNoise[algs];
I would want to do the same in Rust by creating a vector of boxes that hold pointers to that perlin noise object ?
how should I do this ? hmm
I did
fn new(count: i32) -> OctaveNoise {
    let mut algs = vec![];

    for i in 0..count {

    OctaveNoise {
      algs: algs,
      count: count
let me know if that's wrong/another way
Feb 10 2017 02:12
Also, what is the Rust equivalent of interfaces?
I'm trying to port some Java code if you haven't noticed :P
just some noise stuff
Peter Atashian
Feb 10 2017 02:29
@mhsjlw Traits are like interfaces
@mhsjlw You might be interested in (0..count).map(|_| PerlinNoise::new()).collect()
alternatively iter::repeat(PerlinNoise::new()).take(count).collect()
@mhsjlw Also do consider using IRC, it is much more active than gitter
Jonas Platte
Feb 10 2017 07:23
@mhsjlw Instead of 0f64 you can simply write 0.0 (I think 0. and .0 also work here, but I wouldn't personally ever use those shorter forms)
Feb 10 2017 11:05
@retep998 yeah, I use IRC sometimes instead. I just need to figure out how to make a Noise trait that Perkin and Octave can implement so that my combined noise can accept any of those 2 noises
How would I do this?
No, wait I think I remember
I'll give it a try
Feb 10 2017 11:17
Feb 10 2017 14:42
Hello everybody.
Hello users of vscode-rust (RustyCode).
I have opened the PR introducing the documentation about the extension.
Please review it and write what is missing.