Hello,
I've updated my sample code to reflect what I'll do in my main program.
I put it back on the list because it can help as a pattern to manage a
tree of polymorph object.
It compile and works.
I have some question too because I'm not sure I've done it the right way:
* I cross the tree
I try to implement a sort of zoom UI. The UI components are organized in
a tree. To update a component in the UI I use a search function
(match_fn() in the example) which take a closure as search criteria and
if it returns something I use an update function (test_mutable) with a
closure to do
),
None = {},
}
}
}
#[main]
fn main() {
TestMatchBorrow();
}
**
On Thu, Apr 24, 2014 at 9:23 PM, Philippe Delrieu
philippe.delr...@free.fr mailto:philippe.delr...@free.fr wrote:
Hello,
I have a problem in my
Hello,
I have a problem in my code and I can't find a solution. I develop a
test case that generate the same error. Any idea?
use std::vec::Vec;
use std::rc::Rc;
use std::cell::RefCell;
struct Test;
impl Test {
fn match_fn'a('a self) -Option'a Test {
None
}
fn
to an object. So it seems that tray is useful to
pass or return parameters to method but not to store data.
Philippe
Le 09/04/2014 21:53, Philippe Delrieu a écrit :
I find a solution by removing the ~ to Base trait.
The code
//(First and Second think as defined earlier)
enum BaseImpl
Since my last today gill fetch I have this error:
error: instantiating a type parameter with an incompatible type
`~BaseImpl`, which does not fulfill `Send`
for this code :
trait Base{}
struct SecondThink{
count2: int,
}
enum BaseImpl{
FirstThinkImpl(~Base),
(){
println!(ici Second count:{:?}, think.isSecondThink());
}
for think in container.iter_second(){
println!(ici Second count:{:?}, think.isSecondThink());
}
container.appli_secondthink_someprocess(some_second_process);
}
Le 07/04/2014 13:17, Philippe Delrieu a écrit
Thanks for your help. I'll test ASAP.
I use the counter mutable var to have a simple implantation of the
iterator to make the code works. Thank for you're example to show a
better way. I was thinking of a similar way but I would like to avoid
the specific struct with perhaps use a recursive
, Rodrigo Rivas a écrit :
On Sun, Apr 6, 2014 at 7:50 PM, Philippe Delrieu
philippe.delr...@free.fr wrote:
I need some more help.
The impl Iteratormut ~Base for Container declaration generate the error:
error: missing lifetime specifier
So I had it but I can't manage to return the next value
,
Le 05/04/2014 21:59, Rodrigo Rivas a écrit :
On Fri, Apr 4, 2014 at 10:41 PM, Philippe Delrieu
philippe.delr...@free.fr wrote:
Hello,
I've some problem to find a solution for something I want to do with a
vector of enum. This is an example of what I want to do:
trait Base{
fn
Very good idea. The vector don't have to be modified so it'll work.
Thank you for the advice. I make a try an I'll post the result.
Philippe
Le 05/04/2014 21:59, Rodrigo Rivas a écrit :
On Fri, Apr 4, 2014 at 10:41 PM, Philippe Delrieu
philippe.delr...@free.fr wrote:
Hello,
I've some
Hello,
I've some problem to find a solution for something I want to do with a
vector of enum. This is an example of what I want to do:
trait Base{
fn set_something(mut self);
}
struct FirstThink;
impl Base for FirstThink{
fn set_something(mut self){}
}
struct SecondThink;
Thank for you reply. But I don't see any solution to my problem.. I'll
explain it a little more.
I want to develop a sort of GUI. The GUI has its own logic and use a
rendering engine to do the work. I want my GUI separate of the rendering
engine.
In the first solution I use a trait that hide
don't find the answer I'll post a new example.
Philippe
Le 09/02/2014 00:56, Ashish Myles a écrit :
On Sat, Feb 8, 2014 at 6:48 PM, Ashish Myles marci...@gmail.com
mailto:marci...@gmail.com wrote:
On Sat, Feb 8, 2014 at 1:21 PM, Philippe Delrieu
philippe.delr...@free.fr
Any info or idea?
I update from the master and now all my project have the same issue.
If I use rustc I have no problem. I see the thread about rustpkg,
perhaps I should migrate to rustc and cmake?
Philippe
Le 26/01/2014 16:25, Philippe Delrieu a écrit :
Hi,
I have the same problem since 2
Thanks for you answer . I have the idea to see in the SDL port (I work
on the SDL2 port) which is finished and has the same problems. They
solve the problem like this :
pub fn unfold_bits(bitflags: u32) - ~[SDL_WindowFlags] {
let flags = [SDL_WINDOW_FULLSCREEN,
I found the problem. I had to rebuild all my external C binding that was
compiled with the old version of rustc.
Before rustc were crashing. Now I have this error.
Philippe
Le 02/01/2014 22:40, Philippe Delrieu a écrit :
I update with the master and now I have this error with a code
I update with the master and now I have this error with a code that was
compiling before.
... rs:1:1: 1:1 error: can't find crate for `std`
The error is at the first line which ever was the first line. Not all
crate have the problem.
Philippe Delrieu
`, in a bounded closure
The function signature :
pub fn Pt_startT:Send (self, resolution : u64, userData : T ,
callback: 'static |u64, T|) {
Philippe
Le 24/12/2013 19:06, Patrick Walton a écrit :
On 12/24/13 3:41 AM, Philippe Delrieu wrote:
Hello,
I try to capture a closure in a task and I have
();
callback(10, userData);
}
}
}
thank for your help.
Philippe Delrieu
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
);
^~~~
I have the same type of errors in my code plus other error when the
trait can't be found like type `MyType` does not implement any method in
scope named `encode` and the function is implemented just above.
This code where compiling last week.
Philippe Delrieu
something like
let rc = endpoint.with_c_str(|cstr| {
unsafe {smq_bind(self.sock, cstr)}
});
I can't speculate on your encode error without seeing it.
-Kevin
On Dec 5, 2013, at 12:43 AM, Philippe Delrieu philippe.delr...@free.fr wrote:
Hello,
since a few days, I have a lot of new
` not found for encode,
or to add all `use` needed when using a type and its implementation.
Philippe
Le 05/12/2013 10:53, Philippe Delrieu a écrit :
Thank you it correct my first problems.
I didn't send code because I thought it has the same cause. For the
last problems the code is :
use extra
with that
signature, but even that wouldn't be great if you had the signature
off.
On Thu, Dec 5, 2013 at 3:26 PM, Philippe Delrieu
philippe.delr...@free.fr wrote:
I found my error. It's a classical problem.
TestStruct2 implement the trait `extra::serialize::Encodable` using the
generated impl by the compiler.
I
I find this message better than the current. It won't mislead me.
Le 05/12/2013 22:50, Corey Richardson a écrit :
How about method `foo` no found and no trait in scope provided one ?
On Thu, Dec 5, 2013 at 4:29 PM, Philippe Delrieu
philippe.delr...@free.fr wrote:
Perhaps the error message can
Delrieu
Le 01/12/2013 18:28, Philippe Delrieu a écrit :
I see the PR has been approved to I try to implements the method 'pub
fn buffer_encodeT:EncodableEncoder(to_encode_object: T) - ~[u8]'
and I have this error : error: wrong number of lifetime parameters:
expected 1 but found 0 and indicate
str_encodeT:EncodableEncoder(to_encode_object: T) - ~str
pub fn buffer_encodeT:EncodableEncoder(to_encode_object: T) - ~[u8]
and remove the other.
Any remaqs?
Philippe
Le 29/11/2013 10:44, Gaetan a écrit :
I would prefere this function returns a str.
Le 29 nov. 2013 09:27, Philippe Delrieu philippe.delr
);
to_encode_object.encode(mut encoder);
let buff:~[u8] = m.inner_ref();
str::from_utf8(*buff)
}
I'll do at least one copy (one less than the other impl) but the code is
copied.
Is there a better way to manage pointer of memory across function calls?
Philippe
Le 29/11/2013 12:55, Philippe Delrieu
MemWriter
But I can't use the method with a struct that implement Encodable. The
error : mismatched types: expected `V31` but found ..
I have another question :
I would like to return a MemWriter and not a @mut MemWriter . I didn't
find a way to convert the @mut to ~
Philippe Delrieu
change.
Philippe Delrieu
Le 22/11/2013 19:22, Philippe Delrieu a écrit :
I've done the modification in json.rs (add comment with sample code in
md format and test code).
I've do the commit and git pull.
The test compile but I didn't manage to run it.
I use the command: make -j 20 check
'undecorate' a Reader/Writer
/// that has been boxed. Is that ok? This feature is mostly useful for
/// extracting the buffer from MemWriter
fn inner(self) - T;
My second question is how to convert a ~[u8] to a ~std ?
Philippe Delrieu
= Philippe Delrieu)];
#[feature(managed_boxes)];
extern mod extra;
use std::io::mem::MemWriter;
use extra::serialize::Decodable;
use extra::serialize::Encodable;
use extra::serialize::Encoder;
use extra::json::{Json, Decoder, ToJson, Object};
use extra::treemap::TreeMap;
use std::io::Decorator
a ~[u8] to a ~std ?
Philippe Delrieu
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
Selon Philippe Delrieu philippe.delr...@free.fr:
Thanks you it works in my simple test but I have this error when I add
it in my program : error: can't find crate for `std`
I try to find why it doesn't work in my program and I found the error
occurs when I add the extern mod zmq;.
Perhaps I
Hello,
I would like to share my experience about the Rust doc and the tutorial.
I've just started to learn Rust and I've decided to use it on a project
I work on. Like everybody I read the Rust tutorial. It's not a really a
tutorial for beginner but it do a good job in presenting Rust and its
is in the module documentation.
-
Gaetan
2013/11/19 Philippe Delrieu philippe.delr...@free.fr
mailto:philippe.delr...@free.fr
Hello,
I would like to share my experience about the Rust doc and the
tutorial. I've just started to learn Rust and I've decided
I still struggle with the json API. I try it using encode and decode API
and I face a problem.
I take this code in the json test case :
let m = @mut MemWriter::new();
f(m as @mut io::Writer);
and I have an error :
The managed box syntax will be replaced by a library type, and a
!(Received {}, s);
}
responder.send_str(World, 0);
timer::sleep(100);
}
}
timer::sleep(1);
}
Philippe Delrieu
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust
. It make me think
about I#ifndef in C.
Philippe Delrieu
Le 08/11/2013 09:53, Alex Crichton a écrit :
You should be careful to declare modules only once. It looks like you
have two instances of mod actions in the module hierarchy, and both
modules will be compiled as separate entities
::SingleThreaded) and now it work.
Philippe Delrieu
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
of a socket to libuv to protect
against task deadlocking.
On Friday, November 8, 2013, Philippe Delrieu wrote:
I found the problem. Rust schedules task in the same thread. If I
stop the thread (the recv call sleep I think), every task stop.
So I read the doc and I see the spawn_sched method
I solve my problem by using absolute path every where. It's ok but I
can't use the source file in another program with another root module.
Philippe Delrieu
I've read the tutorial
Le 08/11/2013 20:36, Alex Crichton a écrit :
I would recommend reading about Rust's module system at
http
::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
43 matches
Mail list logo