News for hackers. Stuff that matters.
Re:A simple UI framework for Rust by anonfunction on Tuesday May 19, 2015 @04:59AM (#9568775)
Screenshots would be helpful for a project like this.
Re:A simple UI framework for Rust by pdpi on Tuesday May 19, 2015 @05:19AM (#9568814)
http://iup.sourceforge.net/en/screenshots.html

These are for the widget toolkit this project is based on, rather than from the project proper, but it's better than nothing I guess.

Re:A simple UI framework for Rust by yarper on Tuesday May 19, 2015 @09:08AM (#9569717)
Rather than seeing more GTK bindings or lookalikes I personally am waiting for something like WPF/XAML or JavaFx/FXML to turn up.

Anyone seen any projects like this for rust?

Re:A simple UI framework for Rust by steveklabnik on Tuesday May 19, 2015 @12:01PM (#9571078)
It's not like that, but the other non-bindings toolkit that exists is Conrod: https://github.com/PistonDevelopers/conrod
Re:A simple UI framework for Rust by halosghost on Tuesday May 19, 2015 @09:34AM (#9569889)
Cool, I didn't know about IUP at all! Rust has burned me a bit lately (muh 128-bit arithmetic, no!), but I still have a fair bit of nostalgia for Lua; I have a sneaking suspicion I will look to IUP for some of my planned projects. At the very least, cool project and I learned about another cool thing!
Re:A simple UI framework for Rust by outworlder on Tuesday May 19, 2015 @10:56AM (#9570484)
IUP is one of the friendliest toolkits to write bindings for.
Re:A simple UI framework for Rust by jessewmc on Tuesday May 19, 2015 @01:26PM (#9571678)
IUP is a little quirky and a pain to install, but really nice to work with.
Re:A simple UI framework for Rust by fit2rule on Tuesday May 19, 2015 @07:50AM (#9569336)
Can anyone explain what IUP is and why its needed for this toolkit? Because it seems to me that a UI framework shouldn't come with a dependency on system-specific binaries, but that's just because I don't understand what it is, probably.
Re:A simple UI framework for Rust by tbirdz on Tuesday May 19, 2015 @08:58AM (#9569662)
IUP is a GUI Widget Toolkit.
Re:A simple UI framework for Rust by jguegant on Tuesday May 19, 2015 @08:14AM (#9569444)
Out of curiosity: why the author tends to write "self" at the end of the methods ?
Re:A simple UI framework for Rust by jffry on Tuesday May 19, 2015 @08:22AM (#9569495)
In rust that will return itself, which allows you to chain method calls, if that's your style. For example, with the Timer class [1], you could write:

  someTimer.set_interval(1000).start();
instead of writing:

  someTimer.set_interval(1000);
  someTimer.start();

[1]: https://github.com/cybergeek94/kiss-ui/blob/master/src/timer...
Re:A simple UI framework for Rust by sanderjd on Tuesday May 19, 2015 @11:41AM (#9570925)
All the other comments are right, and in Rust this is referred to as "the builder pattern", and is used quite commonly. Here's a guidelines link[0] describing it in more detail.

[0]: https://aturon.github.io/ownership/builders.html

Re:A simple UI framework for Rust by steveklabnik on Tuesday May 19, 2015 @12:03PM (#9571097)
Note that those guidelines are outdated, superseded by https://github.com/rust-lang/rust-guidelines

Note that _those_ guidelines are outdated, superseded by https://github.com/rust-lang/rust/tree/master/src/doc/style and http://doc.rust-lang.org/style/

Note that we haven't linked to those publicly all that much yet, as there's so much TODO in them still.

Ahh, Rust. :)

There's a part in the book about the builder pattern: http://doc.rust-lang.org/stable/book/method-syntax.html#buil...

Re:A simple UI framework for Rust by sanderjd on Tuesday May 19, 2015 @04:48PM (#9573034)
Thanks for the updated links! I totally committed the sin of linking to the first thing from google that looked approximately right.
Re:A simple UI framework for Rust by steveklabnik on Tuesday May 19, 2015 @04:53PM (#9573062)
It's at least partially our fault. (And basically entirely so, really :) ) Gotta get on that rel=canonical at least. Old search results are a big problem :/
Re:A simple UI framework for Rust by weavie on Tuesday May 19, 2015 @08:20AM (#9569477)
This would be to enable method chaining so you can do stuff like:

    dialog.set_title("blah").set_size_pixels(100, 100);
(note syntax may be out - I am not a Rust expert...)
Re:A simple UI framework for Rust by zimbatm on Tuesday May 19, 2015 @08:44AM (#9569602)
Couldn't one write a chain macro instead ? That way you don't have to rely on the library to return self.

    chain!(dialog, set_title("blah"), set_size_piels(100, 100));
Re:A simple UI framework for Rust by rylee on Tuesday May 19, 2015 @09:24AM (#9569811)
Okay, yes, you could do that, but the library itself provides this as its idiomatic way of doing things.
Re:A simple UI framework for Rust by escherize on Tuesday May 19, 2015 @10:52AM (#9570448)
The macro is a better solution, since you can't rely on every library doing this kind of thing.
Re:A simple UI framework for Rust by skj on Tuesday May 19, 2015 @10:59AM (#9570514)
Why wouldn't I want to do

dialog.set_title("blah");

dialog.set_size_piels(100, 100);

on two lines?

Re:A simple UI framework for Rust by kedean on Tuesday May 19, 2015 @02:26PM (#9572122)
Different strokes. It's a common idiom in JavaScript, for instance. You can do multiple lines if you want, nothing stops you.
Re:A simple UI framework for Rust by tedunangst on Tuesday May 19, 2015 @11:03AM (#9570560)
Because functional programming.
Re:A simple UI framework for Rust by sp332 on Tuesday May 19, 2015 @11:14AM (#9570695)
To expand a bit: Sometimes, instead of thinking about nouns all the time, you want to think about verbs. Instead of saying "mutate this noun by applying verb1" and then "mutate this noun by applying verb2" etc, you are creating a new verb. The new verb is "verb1 then verb2 then...." And then when you have the verb defined, you apply it to your object.
Re:A simple UI framework for Rust by Jweb_Guru on Tuesday May 19, 2015 @12:02PM (#9571094)
I feel APIs like that are a bit misleading in Rust in many cases, though, since they're also mutating the original. In Rust, if you want to perform a functional update like that you should take the type by move, but almost everyone just uses mutating APIs because mutation is explicit in the signature anyway. I think that's one of the biggest differences in practice between Rust and other MLs (with which it otherwise has a lot in common): in most MLs, mutation is treated as a last resort, while in Rust it's extremely common because it (generally) doesn't have nonlocal effects.
Re:A simple UI framework for Rust by whoisthemachine on Tuesday May 19, 2015 @11:59AM (#9571067)
Impressive what people are building in little time with Rust!
Re:A simple UI framework for Rust by amelius on Tuesday May 19, 2015 @05:38AM (#9568875)
Cool, but why not build on top of the Servo engine? Or am I missing something?
Re:A simple UI framework for Rust by phn on Tuesday May 19, 2015 @05:57AM (#9568934)
Because it is not web based.
Re:A simple UI framework for Rust by amelius on Tuesday May 19, 2015 @09:26AM (#9569821)
Does that matter? I bet the core Servo libraries don't even deal with networking. And using Servo has obvious advantages such as a being a good render engine supporting incremental updates, probably being well-documented, well-tested, and conforming to well-known standards (yes, also used on the web, but does that matter really?)
Re:A simple UI framework for Rust by phn on Tuesday May 19, 2015 @10:50AM (#9570433)
Honestly, it matters. Current web technologies aren't the end game solution for interfaces and, IMO, are pretty horrible to work with for that purpose. (Pretty beaten up topic by now, but lets take a moment to think for a second about vertical centering in HTML+CSS. /sigh </rant>)

Still, my answer was just referring to the fact that this is not using web tech, and thus, not using servo or any other existing browser engine.

Re:A simple UI framework for Rust by marchelzo on Tuesday May 19, 2015 @12:29PM (#9571278)
flexbox + viewport units have made this better.
Re:A simple UI framework for Rust by tedunangst on Tuesday May 19, 2015 @09:33AM (#9569881)
Because it is not HTML based.