Hello,
New to Rust. Is there (already) a list for mutual help in the usage of Rust? If
not, I guess it may be worth having one, distinct from the dev list, even if the
language is a moving target, even for people who rather intend, at terms, to
participate in the development. It is in fact
If you really need such a small memory footprint for your tasks, I am of
the opinion that it would be less error prone (whoops, accidentally used 64
bytes of stack than I should have, now I'm using twice as much memory!) to
use an async event loop, like libevent, rather than a task model. It just
Segmented stacks aren't the only solution though.
If the concern is many tasks that block for a long time, I imagine a
mechanism to bundle a bunch of small, dormant stacks into a single page so
that the original pages could be released to the OS.
If stacks were additionally relocatable (which
On 11/5/13 2:44 AM, spir wrote:
Why not just add a declaration of the trait at the top of the struct
type def?
struct PairListVal : Iterable {
You can implement traits on types that aren't structs.
* either the methods inside the struct def:
struct PairListVal {
fn push (self, key:Key,
On 11/5/13 8:32 AM, David Piepgrass wrote:
Segmented stacks aren't the only solution though.
If the concern is many tasks that block for a long time, I imagine a
mechanism to bundle a bunch of small, dormant stacks into a single page
so that the original pages could be released to the OS.
If
On 11/05/2013 06:17 PM, Patrick Walton wrote:
On 11/5/13 2:44 AM, spir wrote:
That you very much for this complete answer, Patrick. Things are clearer.
Denis
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
On Tue, Nov 5, 2013 at 9:17 AM, Patrick Walton pcwal...@mozilla.com wrote:
On 11/5/13 2:44 AM, spir wrote:
Why not just add a declaration of the trait at the top of the struct
type def?
struct PairListVal : Iterable {
You can implement traits on types that aren't structs.
Isn't
As long as you are the person who owns the type, yeah, but I suspect
that's not what you mean. Coherence requires that you only implement traits
for types if you own either the trait or the type (or both). You can't
implement a 3rd party trait for a 3rd party type, since then there could be
On 11/04/2013 07:50 PM, Bill Myers wrote:
The advantage of segmented stacks is that blocked tasks only take up
as much memory as they actually need to store state, so that for
instance a network server can use a task for each connection, and
still only use, say, 64 bytes per connection if
C# Async/Await is distinct from segmented stacks because they store the
enclosed variables as heap objects rather than on the stack; that means it
goes through the same malloc/garbage collector as any other heap objects
you create. It's purely a compiler fiction to let you write code that
'looks'
On Tue, Nov 5, 2013 at 4:40 PM, Brian Anderson bander...@mozilla.com wrote:
On 11/04/2013 07:50 PM, Bill Myers wrote:
The advantage of segmented stacks is that blocked tasks only take up as much
memory as they actually need to store state, so that for instance a network
server can use a task
The following seems to work:
trait Double {
fn double(self) - Self;
}
impl Double for int {
fn double(self) - int {
*self * 2
}
}
fn main() {
let x = 2;
println!({}, x.double()); // prints 4
}
--
Ziad
On Tue, Nov 5, 2013 at 1:29 PM, Steven Blenkinsop
Here you own the trait Double. Doesn't work if you were trying to
implement a trait you hadn't just defined. The specific examples you
mentioned were Clone and Drop, so that wouldn't work.
On Tuesday, November 5, 2013, Ziad Hatahet wrote:
The following seems to work:
trait Double {
fn
Gotcha. But it is still pretty flexible in that you are not bound to the
impls that were originally defined on the type (e.g. like C++/Java where
the list of interfaces implemented by a class are fixed). This relieves one
form writing wrapper classes in order for certain structs to adhere to
I can write this:
struct Points {xs:~[uint], ys:~[uint]}
fn main () {
let mut ps = Points{xs:~[1u], ys:~[1u]};
...
}
But I cannot write that:
struct PointsT {xs:~[T], ys:~[T]}
fn main () {
let mut ps = Pointsuint{xs:~[1u], ys:~[1u]};
...
}
In
15 matches
Mail list logo