Hello, rust addict.
I have a problem with rustc. I have 3 files.
The first one actions.rs contains a trait declaration :
pub trait Action {
// process the action on server side.
fn process(&self) -> ~str;
}
The second contains a trait implementation testaction.rs:
mod actions;
pub struct TestAction {
actiontype: uint
}
impl actions::Action for TestAction {
fn process(&self) -> ~str {
~""
}
}
The third test the trait cast :
mod actions;
mod midi;
let element : ~testaction::TestAction =
~testaction::TestAction{actiontype:1};
let actelm: ~actions::Action = element as
~actions::Action; //error here
println("process element :" + actelm.process());
=> generate error: failed to find an implementation of trait
let actelm: ~testaction::actions::Action = element as
~testaction::actions::Action; //error here
println("process element :" + actelm.process());
=> generate error: trait `Action` is inaccessible
If I put testaction content in the test file rustc compile.
Any idea?
Philippe Delrieu
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev