Skip to content

Instantly share code, notes, and snippets.

RustAlgebloat/src/vector/maps.rs:22:3: 23:3 error: multiple applicable methods in scope
RustAlgebloat/src/vector/maps.rs:22 a.sin()
RustAlgebloat/src/vector/maps.rs:23 }
RustAlgebloat/src/vector/maps.rs:35:2: 38:3 note: candidate #1 is `vector::maps::VectorSinOp$T::sin`
RustAlgebloat/src/vector/maps.rs:35 fn sin(&self) -> VectorUnOp<T, SinOp>
RustAlgebloat/src/vector/maps.rs:36 {
RustAlgebloat/src/vector/maps.rs:37 VectorUnOp::new(self.clone(), SinOp::new())
RustAlgebloat/src/vector/maps.rs:38 }
RustAlgebloat/src/vector/maps.rs:22:3: 23:3 note: candidate #2 is `std::f32::Real$f32::sin`
RustAlgebloat/src/vector/maps.rs:22 a.sin()
@SiegeLord
SiegeLord / test.rs
Created February 6, 2014 17:56
Chaining results
#[feature(macro_rules)];
struct Obj;
impl Doer<Obj> for Obj
{
fn func1<'l>(&'l self) -> Result<&'l Obj, ~str>
{
Ok(self)
}
@SiegeLord
SiegeLord / errors
Created February 7, 2014 17:54
Trait bug
test.rs:24:3: 24:19 error: multiple applicable methods in scope
test.rs:24 self.get().sin()
^~~~~~~~~~~~~~~~
test.rs:22:2: 25:3 note: candidate #1 is `Sin$T::sin`
test.rs:22 fn sin(&self) -> f32
test.rs:23 {
test.rs:24 self.get().sin()
test.rs:25 }
test.rs:24:3: 24:19 note: candidate #2 is `std::f32::Real$f32::sin`
test.rs:24 self.get().sin()
@SiegeLord
SiegeLord / test.rs
Created February 19, 2014 19:50
Hehehe
trait MyMul<RHS, Res>
{
fn mul(&self, rhs: &RHS) -> Res;
}
impl<T: ToPrimitive> MyMul<f64, f64> for T
{
fn mul(&self, rhs: &f64) -> f64
{
self.to_f64().unwrap() * *rhs
@SiegeLord
SiegeLord / components.rs
Last active August 29, 2015 13:56
Component test
struct Location
{
x: f32,
y: f32
}
struct Velocity
{
vx: f32,
vy: f32
struct S;
trait A
{
fn test(self);
}
impl<'l> A for &'l S
{
fn test(self)
@SiegeLord
SiegeLord / test.rs
Created March 7, 2014 23:45
get/set
struct S;
trait Get
{
fn get(self);
}
trait Set
{
fn set(self);
}
@SiegeLord
SiegeLord / test.rs
Created March 8, 2014 00:28
Mutable hacks
struct S<T>
{
data: T
}
trait Mut<'l>
{
fn set(self, idx: uint, val: u8);
}
@SiegeLord
SiegeLord / test.rs
Created March 8, 2014 00:41
More mutability
struct S<'l>
{
data: &'l [u8]
}
struct MS<'l>
{
data: &'l mut [u8]
}
@SiegeLord
SiegeLord / test.rs
Last active August 29, 2015 13:57
Arrays
struct MyArray<T>(~[T]);
trait Foo {}
struct A;
impl Foo for A {}
struct B;
impl Foo for B {}