> Just to be clear, do you mean a function outside the iface and impl?
Yes, that's what I meant.
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
Just to be clear, do you mean a function outside the iface and impl?
fn create_u32_date_from_str(ds: str) {
...
}
Ted
On 2012-02-21, at 10:03, Marijn Haverbeke wrote:
>> It wasn't the cast that felt funny to me, it was the role of 0_u32 in the
>> expression. Its only purpose is to giv
> It wasn't the cast that felt funny to me, it was the role of 0_u32 in the
> expression. Its only purpose is to give access to the date impl over u32
> which is ok, but I'm used to having something like class methods for that.
Right. As I said, just use constructor functions with different nam
It wasn't the cast that felt funny to me, it was the role of 0_u32 in the
expression. Its only purpose is to give access to the date impl over u32 which
is ok, but I'm used to having something like class methods for that.
Ted
On 2012-02-21, at 09:08, Marijn Haverbeke wrote:
>> let d = (0_u32
> let d = (0_u32 as date).from_str("2001-04-01");
There's no reason to cast to an iface just to call a method on a
value. 0_u32.from_str("...") should be equivalent.
If you want to have different from_str constructor functions, though,
just give them different names instead of using a kludge like
Ok, so put me down as +1 on const vectors in particular and const expressions
in general.
My next question was about constructors. I want to have multiple impls of an
face (say date as u32 number of days and date as a record of year, month, day).
I want to have constructors so that I can chec
On 02/20/2012 11:44 AM, Ted Horst wrote:
Is there a better way to do this in rust?
I think this is the sincerest form of a feature request for const
vectors. :)
There's a bug on it here: https://github.com/mozilla/rust/issues/571
Patrick
___
Rust-
Hi,
I started working on a datetime module that you can check out at:
https://github.com/tedhorst/rust_datetime
While working on this I had some questions about rust style or idioms. The
first one was about how to implement what would be static arrays in C, e.g.:
static int MONTHLENGTH[][13]